'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;
  const ObjectId = Schema.ObjectId;

  const PatientSchema = new Schema({
    user_id: { type: ObjectId },
    image: { type: String },
    name: { type: String },
    birthday: { type: String },
    age: { type: Number },
    sex: { type: String },
    phone: { type: String },
    id_card_type: { type: String },
    id_card_num: { type: String },
    address: { type: String },
    address_hold: { type: String },
    state: { type: String },
    active: { type: Boolean, default: false },
    create_at: { type: Date, default: Date.now },
    update_at: { type: Date, default: Date.now },
  });

  return mongoose.model('Patient', PatientSchema);
};